package routers

import (
	"advertising/internal/app/web/controller"
	"advertising/internal/app/web/middleware"

	"github.com/gin-gonic/gin"
)

func Default(r *gin.Engine) {
	/*健康检查*/
	r.GET("/health", func(c *gin.Context) {
		c.JSON(200, "ok")
	})
	NonAuthRouter(r.Group("nonauth"))

	r.POST("/login", controller.Index{}.Login)
	r.GET("/captcha", controller.Index{}.GetCaptcha) // 获取图形验证码
	r.GET("/h5/schedule-detail", controller.PublishSchedule{}.SimpleDetail)

	// 推广统计
	{
		r.GET("/promotion/detail", controller.PromotionCount{}.Detail)
		r.POST("/promotion/increase", controller.PromotionCount{}.Increase)
	}

	r.Use(middleware.AccessCheck())

	r.POST("/upload/file-upload", controller.Index{}.FileUpload)
	r.GET("/location/area-location", controller.Index{}.AreaLocation)
	r.GET("/device/all", controller.Index{}.AllDeviceList)
	MaterialRouter(r.Group("material"))
	PublishScheduleRouter(r.Group("publish-schedule"))
	SupportActivityRouter(r.Group("support-avtivity"))
}
